<nav-bar-panel></nav-bar-panel>
<div class="content container">
    <h1>微信推送消息（图文消息）</h1>

    <div class="row">
        <div class="col-md-3" style="border-right: solid 1px black;">
            <h4>图文列表</h4>

            <table class="table table-striped">
                <thead>
                <th>#</th>
                <th>图文标题</th>
                <th>是否推送</th>
                <th>操作</th>
                </thead>
                <tbody>
                <tr ng-repeat="wechatPush in wechatPushes">
                    <td>{{$index+1}}</td>
                    <td>{{wechatPush.title}} <span class="glyphicon glyphicon-zoom-in"
                                                   ng-click="viewWechatPushContent(wechatPush)">查看</span></td>
                    <td>{{wechatPush.pushed>0?'已推送':'未推送'}}</td>
                    <td>
                        <span class="glyphicon glyphicon-remove"
                              ng-click="removeWechatPushContent(wechatPush)">删除</span>
                    </td>
                </tr>
                </tbody>
            </table>
            <!--<div class="list-group">-->
            <!--<a ng-click="viewWechatPushContent(wechatPush)"-->
            <!--ng-repeat="wechatPush in wechatPushes"-->
            <!--class="list-group-item">-->
            <!--{{wechatPush.title}}-->
            <!--{{wechatPush.createTime| date: 'yyyy-MM-dd'}}-->
            <!--</a>-->
            <!--</div>-->
            <div class="m-pager">
                <button class="glyphicon glyphicon-triangle-left"
                        ng-click="pushsPage = pushsPage - 1; loadWechatPushes()">
                </button>
                <span>第{{pushsPage}}页</span>
                <button class="glyphicon glyphicon-triangle-right"
                        ng-click="pushsPage = pushsPage + 1; loadWechatPushes()">
                </button>
            </div>
            <div ng-show="wechatHistories.length>0">
                <h4>推送历史记录</h4>
                <ul class="list-group">
                    <li class="list-group-item" ng-repeat="history in wechatHistories">
                        <span>{{history.createTime | date: 'yyyy-MM-dd'}}</span>
                        <span>推送人: {{history.user.displayName}}</span>
                    </li>
                </ul>
            </div>
        </div>
        <div class="col-md-3">
            <h4>图文内容</h4>
            <div ng-repeat="pushItem in pushItems">
                <span>{{pushItem.title}}</span>
                <img src="/wechatshop/file/view_direct/{{pushItem.mediaFileId}}" alt="" style="width: 50px; height: 50px"/>
                <button class="glyphicon glyphicon-pencil" ng-click="selectPushItem(pushItem)"></button>
                <button class="glyphicon glyphicon-remove" ng-click="removePushItem(pushItem)" ng-show="!readOnly">删除
                </button>
            </div>
        </div>
        <div class="col-md-6" style="border-left: solid 1px black">
            <div>
                <button class="btn btn-danger btn-sm" ng-click="createWechatPushNews()">创建</button>
                <button class="btn btn-danger btn-sm" ng-click="addNewItemToPushNews()" ng-show="!readOnly">添加图文
                </button>
                <!--<button class="btn btn-danger btn-sm" ng-click="pushToWechat(pushItems)" ng-show="!readOnly">-->
                <!--推送微信消息（每天有限制次数）-->
                <!--</button>-->
                <button class="btn btn-danger btn-sm" ng-click="saveWechatPushContent(pushItems)">
                    保存
                </button>
                <button class="btn btn-danger btn-sm" ng-click="pushWechatContent(currentPushContentId)"
                        ng-show="readOnly">
                    保存并推送微信图文（每天有限制次数）
                </button>
            </div>
            <div>
                <div>
                    <div class="form-horizontal">
                        <div class="form-group">
                            <label class="col-sm-2 control-label">图文标题</label>

                            <div class="col-sm-10">
                                <input type="text" class="form-control"
                                       ng-model="currentPushItem.title">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">正文</label>

                            <div class="col-sm-10">
                                <ueditor ng-model="currentPushItem.content"></ueditor>
                                <!--<p ng-if="readOnly" ng-bind-html="currentPushItem.content | to_trusted"></p>-->
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">图文描述</label>

                            <div class="col-sm-10">
                                <img src="/wechatshop/file/view_direct/{{currentPushItem.mediaFileId}}" alt=""
                                     style="width: 400px; height: 250px"/>
                                <upload-file-panel upload-button-name="上传图片"
                                                   on-uploaded="onUploadedLastMediaFile"
                                                   is-public="true"></upload-file-panel>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<footer-bar-panel></footer-bar-panel>